<template>
  <el-table :data="tableData.data" style="width: 100%">
    <el-table-column fixed prop="id" label="项目编号" width="150" />
    <el-table-column prop="projectName" label="项目名称" width="200" />
    <el-table-column prop="companyName" label="公司名称" width="200" />
    <el-table-column prop="signingDate" label="签约日期" width="120" />
    <el-table-column prop="projectLeader" label="项目负责人" width="120" />
    <el-table-column prop="contractTermStartAndEnd" label="合约期限" width="200">
      <template #default="scope">
        {{scope.row.contractTermStart}}~{{scope.row.contractTermEnd}}
      </template>
    </el-table-column>
    <el-table-column prop="promotionType" label="推广类型" width="120" />
    <el-table-column prop="promotionNum" label="推广数量" width="120" />
    <el-table-column prop="promotionNum" label="项目状态" width="120" >
      <template #default="scope">
        {{scope.row.status ? '审批完成' : '审批未完成'}}
      </template>
    </el-table-column>
    <el-table-column fixed="right" label="操作" width="200">
      <template #default="scope">
        <el-popconfirm title="确认删除？" @confirm="del(scope.row.id)">
          <template #reference>
            <el-button link type="primary" size="small" >删除</el-button>
          </template>
        </el-popconfirm>
        
        <el-button link type="primary" size="small">详情</el-button>
        <el-button link type="primary" size="small">修改</el-button>
      </template>
    </el-table-column>
  </el-table>
</template>

<script setup lang='ts'>
import { ref,reactive,onMounted } from 'vue'
import { getMoneyList } from '../../api/money'
import { ElMessage } from 'element-plus'
interface MoneyList {
  id:string,
  projectName:string,
  companyName:string,
  signingDate:string,
  projectLeader:string,
  contractTermStart:string,
  contractTermEnd:string,
  promotionType:string,
  promotionNum:number,
  status:boolean
}
const tableData = reactive({
  data:[] as MoneyList[]
})
onMounted(()=>{
  getMoneyListData()
})
const getMoneyListData = async() =>{
  let list = await getMoneyList()
  if(list && list.length){
    ElMessage({
      showClose: true,
      message: '获取数据成功',
      type: 'success',
    })
    tableData.data = list as MoneyList[]
  }
}
//删除
const del = (id:string) =>{
  console.log('点击删除的id',id);
  
}
</script>
<style scoped lang='less'>

</style>